
package com.wctj.api.web.controller.huifu;

import com.wctj.api.base.Result;
import com.zgzg.shop.pay.business.huifu.dto.HuiFuCorpMemberUserDTO;
import com.zgzg.shop.pay.business.huifu.dto.HuiFuMemberUserDTO;
import com.zgzg.shop.pay.business.huifu.dto.HuiFuQueryMemberUserDTO;
import com.zgzg.shop.pay.business.huifu.service.HuiFuPayManagerService;
import com.zgzg.shop.pay.huifu.dto.CorpMemberUserResponse;
import com.zgzg.shop.pay.huifu.dto.MemberUserResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 发起支付入口
 */
@Slf4j
@RestController
@RequestMapping("huifu")
public class HuiFuMemberUserController {
    @Resource
    private HuiFuPayManagerService huiFuPayManagerService;

    /**
     * 个人用户（ Member）-创建实名用户对象
     * @param param
     * @return
     */
    @PostMapping("member/create")
    public Result<MemberUserResponse> createPersonalUser(@RequestBody @Valid HuiFuMemberUserDTO param) {
        return huiFuPayManagerService.createPersonalUser(param);
    }

    /**
     * 个人用户（ Member）-查询用户对象
     * @param param
     * @return
     */
    @PostMapping("member/queryUser")
    public Result<MemberUserResponse> queryPersonalUser
                (@RequestBody @Validated({HuiFuQueryMemberUserDTO.QueryMemberUser.class})HuiFuQueryMemberUserDTO param) {
        return huiFuPayManagerService.queryPersonalUser(param);
    }

    /**
     * 个人用户（ Member）-查询列表用户对象
     * @param param
     * @return
     */
    @PostMapping("member/listUser")
    public Result<List<MemberUserResponse>> listPersonalUser(@RequestBody @Valid HuiFuQueryMemberUserDTO param) {

        return huiFuPayManagerService.listPersonalUser(param);
    }


    /**
     * 企业用户（ Member）-创建企业用户对象
     * @param param
     * @return
     */
    @PostMapping("corpMember/create")
    public Result<CorpMemberUserResponse> createCorpMember(@ModelAttribute @Valid HuiFuCorpMemberUserDTO param) {
        return huiFuPayManagerService.createCorpMember(param);
    }
}
